Skip to content

fix: HAR exports are always redacted and risky tools ask in the window - #28

Merged
nodemode-ai merged 6 commits into
mainfrom
fix/owner-decisions-2026-11-29
Nov 30, 2026
Merged

nodemode-ai merged 6 commits into
mainfrom
fix/owner-decisions-2026-11-29

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • HAR export redaction: the whole user part of a URL is replaced, a bare user name included, using url.Parse, with a fallback for URLs that do not parse and coverage for scheme-relative URLs.
  • HAR export redaction: query fields without a name are replaced and listed as "(no name)", as is a cookie with an empty name.
  • HAR export redaction: error notes decode query field names before matching and replace secret values both as written and decoded.
  • HAR export redaction: JSON member names with string escapes are decoded before matching when a body does not parse as JSON throughout.
  • Tests for each case in internal/flow/redact_test.go; README and CHANGELOG updated.
  • Only a valid RFC 3986 scheme (a letter, then letters, digits, + - or .) starts a URL with an authority during redaction.
  • When url.Parse finds no user part in a URL with an authority, or reads it as opaque, the user part is cut at the last @ before the path. A user part holding ? or # before its @ is now redacted in URLs and error notes.
  • Query and form field names are decoded and trimmed in one helper, so blank names count as no name and listed names carry no surrounding spaces.
  • Tests cover invalid schemes, user parts that read as a query or fragment, and trimmed field names.

Tests

  • Each change has tests that fail on the code before it.
  • The repo's CI commands were run locally on macOS; every local failure also fails on main in the same environment. Please rely on this PR's CI for Linux and Windows.

How to ship

  • Follows the earlier hardening PR, already merged. Independent of other repos. No version bump.

…export

formnet mcp keeps relying on the MCP host's tool approval and now also
asks the person in FormNET's own window before clear_flows,
set_interception, set_passthrough and export_har act. The question is
held by internal/approval and served at /api/approvals with
approval.asked and approval.done on the stream; it waits two minutes,
is refused at once when no window listens, and changes nothing unless
the person allows it.

export_har always redacts: include_secrets is gone and refused by name,
the tool never asks for secrets=1, and it keeps an export only when the
server reports what it redacted. HAR exports now redact secret headers,
every cookie, query and URL fields, URL passwords and form and JSON body
fields with secret names, replace each value with [redacted], and list
what was redacted in the log comment, each entry's comment and the
X-Formnet-Redacted trailer.
…nd non-UTF-8 bodies in HAR exports

A name written as one word, such as accesstoken or X-CSRFToken, is now
secret when its last word ends in token, secret, password, passwd,
apikey or sessionid. A cookie with a value and no name reads [redacted].
A URL's whole user part is redacted, ending at the last @, since a user
name alone is often a token. Form-encoded and JSON bodies are redacted
by content type even when they are not valid UTF-8.

The README no longer says the other MCP tools redact more than the four
credential headers.
…ames in HAR exports

- Find a URL's user part with url.Parse and replace all of it, a user name
  alone included; scheme-relative URLs are covered, and a URL that does not
  parse is cut at the last @ before the path that follows it.
- Replace query fields without a name (a value alone or =value) and list
  them as "(no name)", as a cookie with an empty name now is.
- In error notes, decode query field names before checking them and take
  out each secret value both as written and decoded.
- Decode JSON string escapes in member names when reading JSON that does
  not parse throughout.
…parts in HAR error notes

- Read a URL whose slashes after the scheme are written as backslashes as
  having an authority, and find its user part without url.Parse, which
  reads such a URL as having none.
- Treat a query field whose name decodes to spaces only as a field without
  a name.
- Take the URL's user part, user name and password out of error notes in
  every spelling, besides the secret query values.
…ds as a query

- Treat the text before a colon as a scheme only when it is a letter
  followed by letters, digits, + - or ., as RFC 3986 defines one.
- When url.Parse finds no user part in a URL with an authority, or reads
  it as opaque, cut the user part at the last @ before the path instead,
  so one holding a ? or # before its @ is still redacted, in the URL and
  in error notes.
- Read a query or form field's name decoded and trimmed in one place, so a
  blank name counts as no name and names are listed without surrounding
  spaces.
…user part

- Skip spaces and control characters before the address, and ignore tabs
  and line breaks inside the scheme and between the slashes, so such an
  address still has its user part redacted in the URL and in error notes.
- Note the change in the changelog.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 23:16
@nodemode-ai
nodemode-ai merged commit 630536e into main Nov 30, 2026
5 checks passed
@nodemode-ai
nodemode-ai deleted the fix/owner-decisions-2026-11-29 branch November 30, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants